package com.dh.cb;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.IntStream;

public class MessageProducer {

    //生产数据
    public void start() {
        while (true) {
            List<String> msgList = new ArrayList<>();
            IntStream.range(0, Constant.BATCH_MSG_SIZE).forEach(i -> {
                msgList.add(i + "_" + UUID.randomUUID().toString());
            });
            MsgContainer.queue.offer(msgList);
            System.out.println("\n\n--------------producer msg------------\n\n");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
